package com.linewell.export.util;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Title: TaskJob
 * @description:
 * @author: pzhongqaing@linewell.com
 * @since: 2020年10月15日 17:07
 */

@DisallowConcurrentExecution
public class TaskJob implements Job {
    Logger logger = LoggerFactory.getLogger(TaskJob.class);

    private static long nextTime = 0;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("==================");
        logger.info("上次时间为：" + nextTime);
        long curTime = System.currentTimeMillis();
        logger.error("当前时间：" + curTime);
        logger.error("时间差为：" + (nextTime - curTime));
        nextTime = curTime;
        try {
            logger.info("线程休眠5秒");
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        logger.info("==================");
    }
}
